from urllib import request
from urllib import parse
from urllib.request import urlopen



'''
# 转码 工作
word = {"wd" : "发的上的发送到发撒的发生"}
print( parse.urlencode(word) )
print( parse.unquote(parse.urlencode(word)) )
'''


'''
# get 方式 获取
url = "http://www.baidu.com/s"
word = {"wd":"京东"}
word = parse.urlencode(word) #转换成url编码格式（字符串）
newurl = url + "?" + word    # url首个分隔符就是 ?
headers={ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"}
req = request.Request(newurl,headers=headers)
response = urlopen(req)
html = response.read()
f = open('cdays-4-test.html', 'w')
f.write(str(html))
f.close()
print(html)
'''



